package com.health.personal.controller;


import com.health.common.core.domain.R;
import com.health.personal.domain.dto.TDoctorDto;
import com.health.personal.domain.po.TDoctorPo;
import com.health.personal.domain.vo.TDoctorVo;
import com.health.personal.service.ITDoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 医生表 前端控制器
 * </p>
 *
 * @author zzs
 * @since 2024-12-12
 */
@RestController
@RequestMapping("/doctor")
public class TDoctorController {


    @Autowired
    private ITDoctorService service;
    /**
     * 登录
     * @param email
     * @return
     */
    @GetMapping("/login/{email}")
    public R<TDoctorPo> login(@PathVariable("email") String email){
        TDoctorPo doctorPo =   service.login(email);
        return R.ok(doctorPo);
    }


    /**
     *注册
     * @param doctorDto
     * @return
     */
    @PostMapping("/user/sign")
    public R sign(@RequestBody TDoctorDto doctorDto){
        service.sign(doctorDto);

        return R.ok("注册成功!");
    }
    /**
     * 发送验证码
     * @param doctorDto
     * @return
     */
    @PostMapping("/getCode")
    public R getCode(@RequestBody TDoctorDto doctorDto){
        service.getCode(doctorDto);
        return R.ok("发送验证码");
    }
    /**
     * 修改密码
     * @param doctorDto
     * @return
     */
    @PostMapping("/changePwd")
    public R changePwd(@RequestBody TDoctorDto doctorDto){
        service.changePwd(doctorDto);
        return R.ok("修改成功！");
    }
    /**
     *医生详细信息
     * @param id
     * @return
     */
    @GetMapping("/selByid/{id}")
    public R<TDoctorVo> selByid(@PathVariable("id") Long id){
        TDoctorVo tDoctorVo = service.selByid(id);
        return R.ok(tDoctorVo);
    }








}
